import type { Route } from "@umijs/route-utils/dist/types";

export default function access(initialState: { currentUser?: API.CurrentUserType }) {
  const { currentUser } = initialState || {};

  return {
    canReadePath: (route: Route) => {
      return currentUser && currentUser.path.some((item: string) => item === route.name)
    }
  };
}
